<?php

	session_start();
	require_once("../db_connect.php");

	//職業登録

	$sub_category_name  = htmlspecialchars($_POST['sub_category_name'],ENT_QUOTES,"UTF-8");

	$sql = "INSERT INTO sub_category (sub_category_name,main_category_id) VALUES (?,?)";

	$stmt = $db->prepare($sql);

    $data = array($sub_category_name,$_SESSION['main_category_id']);

	$db->execute($stmt, $data);     //UPDATE文を実行

	if (PEAR::isError($db)) {       //SQLの実行に失敗すればここでエラー文を出力
    	die($res->getMessage());
	}

	header("Location: manage_main_category_detail.php");
?>